/**
 * 
 */
package entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;

/**
 * @author Chigco.Orc
 *	商品实体类
 */
@Entity
public class Product {
	private Long id;
	private String name;
	private int sellType;			//交易类型
	private int productType;	//宝贝类型
	private Float price;	//一口价
	private String content;	//宝贝信息
	private int count;	//商品数量
	private int payType; //支付方式
	private int inDate;	//有效期
	private String remark;	//购买须知
	private int invoice; //发票 0:无 1：有
	private int guarantee;	//保修 0：无 1：有
	private int state;		//商品状态 0:出售中 1:仓库中 2:已卖出的
	private Long publishDate; //商品发布时间
	private int genuine;  //正品 0:非 1：是
	private int p7day; 	//7天包退 0：非 1：是
	private int freight;		//运费承担  0卖家   1买家
	private User user;
	private Order order;
	private ProductCate productCate;
	
	
	@Id
	@GeneratedValue
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	/*
	 * 商品与用户的关系：多对一
	 */
	@ManyToOne
	@JoinColumn(name = "userId")
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	/*
	 * 商品与订单的关系：多对一
	 */
	@ManyToOne
	@JoinColumn(name = "orderId")
	public Order getOrder() {
		return order;
	}
	public void setOrder(Order order) {
		this.order = order;
	}
	
	@OneToOne
	public ProductCate getProductCate() {
		return productCate;
	}
	public void setProductCate(ProductCate productCate) {
		this.productCate = productCate;
	}
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Float getPrice() {
		return price;
	}
	public void setPrice(Float price) {
		this.price = price;
	}
	public int getCount() {
		return count;
	}
	public void setCount(int count) {
		this.count = count;
	}
	public int getPayType() {
		return payType;
	}
	public void setPayType(int payType) {
		this.payType = payType;
	}
	public int getInDate() {
		return inDate;
	}
	public void setInDate(int inDate) {
		this.inDate = inDate;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public int getInvoice() {
		return invoice;
	}
	public void setInvoice(int invoice) {
		this.invoice = invoice;
	}
	public int getGuarantee() {
		return guarantee;
	}
	public void setGuarantee(int guarantee) {
		this.guarantee = guarantee;
	}
	@Column(length=4000)
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public int getState() {
		return state;
	}
	public void setState(int state) {
		if(state < 0)this.state = 0;
		else
		this.state = state;
	}
	public Long getPublishDate() {
		return publishDate;
	}
	public void setPublishDate(Long publishDate) {
		this.publishDate = publishDate;
	}
	public int getSellType() {
		return sellType;
	}
	public void setSellType(int sellType) {
		this.sellType = sellType;
	}
	public int getProductType() {
		return productType;
	}
	public void setProductType(int productType) {
		this.productType = productType;
	}
	public int getGenuine() {
		return genuine;
	}
	public void setGenuine(int genuine) {
		this.genuine = genuine;
	}
	public int getP7day() {
		return p7day;
	}
	public void setP7day(int p7day) {
		this.p7day = p7day;
	}
	public int getFreight() {
		return freight;
	}
	public void setFreight(int freight) {
		this.freight = freight;
	}
}
